from django.db import models

# Create your models here.
#发布会
class Event(models.Model):
    name=models.CharField(max_length=100)
    limit=models.IntegerField()
    startus=models.BooleanField()
    address=models.CharField(max_length=200)
    start_time=models.DateField(auto_now=True)
    create_time=models.TimeField(auto_now=True)
    def __str__(self):
        return self.name

#嘉宾
class Guest(models.Model):
    event=models.ForeignKey(to='Event',on_delete=models.CASCADE)
    realname=models.CharField(max_length=51)
    phone=models.CharField(max_length=28)
    email=models.EmailField()
    sing=models.BooleanField()
    create_time=models.DateTimeField(auto_now=True)
    class Meta:
        unique_together=('event','phone')
    def __str__(self):
        return self.realname
